<?php
namespace Plu\Library\Services\Redis\Game;

use Plu\Library\Services\ServiceBase;

class GameRedis extends ServiceBase {

    const key_of_category_name = "category:name";

    const key_of_category_domain = "category:domain";

    public function setCategory($id, $name, $domain) {
        $redis = $this->getRedis('vector');

        $redis->hSet(self::key_of_category_name, $id, $name);
        $redis->hSet(self::key_of_category_domain, $id, $domain);
    }

    public function removeCategory($id, $name, $domain) {
        $redis = $this->getRedis('vector');
        
        $redis->hDel(self::key_of_category_name, $id);
        $redis->hDel(self::key_of_category_domain, $id);
    }

    public function getCategoryName($id) {
        $redis = $this->getRedis('vector');

        return $redis->hGet(self::key_of_category_name, $id);
    }

    public function getCategoryDomain($id) {
        $redis = $this->getRedis('vector');

        return $redis->hGet(self::key_of_category_domain, $id);
    }
}

?>
